using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class Member_test2 : Member, IRequiresSessionState
{
	private string productids = "";
	protected TextBox txtId;
	protected HiddenField hfProductID;
	public string Productids
	{
		get
		{
			if (base.Request.QueryString["ProductIDS"] != null)
			{
				this.productids = base.Request.QueryString["ProductIDS"].ToString();
			}
			return this.productids;
		}
		set
		{
			this.productids = value;
		}
	}
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!this.Page.IsPostBack)
		{
			if (!string.IsNullOrEmpty(this.Productids))
			{
				this.txtId.Text = this.Productids;
				this.hfProductID.Value = this.Productids;
			}
			this.getdate();
		}
	}
	private void getdate()
	{
		string text = "2013-05-31 10:10:00.000";
		string value = "2013-5-31 10:01:25";
		string text2 = "";
		DateTime dateTime = Convert.ToDateTime("2013-5-31 10:01:24");
		DateTime dateTime2 = Convert.ToDateTime(text);
		DateTime dateTime3 = Convert.ToDateTime(value);
		if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(value))
		{
			if (dateTime3 > dateTime && dateTime2 < dateTime)
			{
				text2 = string.Concat(new string[]
				{
					"<dl class='nc-detail-price'><dt>开始时间：</dt><dd><strong nctype='goods_price'>",
					text,
					"</strong></dd></dl><dl class='nc-detail-price'><dt>结束时间：</dt><dd><strong nctype='goods_price'>",
					text,
					"</strong></dd></dl>"
				});
			}
		}
		base.Response.WriteLine(new object[]
		{
			"时间:"
		});
		base.Response.WriteLine(new object[]
		{
			"开始时间:" + dateTime2
		});
		base.Response.WriteLine(new object[]
		{
			"现在时间:" + dateTime
		});
		base.Response.WriteLine(new object[]
		{
			"结束时间:" + dateTime3
		});
		base.Response.WriteLine(new object[]
		{
			"比较结束时间大于现在时间" + (dateTime3 > dateTime)
		});
		base.Response.WriteLine(new object[]
		{
			"比较开始时间是否小于现在时间" + (dateTime2 < dateTime)
		});
		base.Response.WriteLine(new object[]
		{
			text2
		});
	}
	private DataTable dtProductInfo(string productidStr)
	{
		DataTable dataTable = null;
		if (!string.IsNullOrEmpty(productidStr))
		{
			dataTable = new DataTable();
			DataColumn column = new DataColumn("ProductID", typeof(string));
			dataTable.Columns.Add(column);
			DataColumn column2 = new DataColumn("ProductType", typeof(string));
			dataTable.Columns.Add(column2);
			DataColumn column3 = new DataColumn("DeliverType", typeof(int));
			dataTable.Columns.Add(column3);
			string sql = "select * from HLShop_Product where ProductID in (" + productidStr + ")";
			DataTable dataTable2 = this.conn.GetDataTable(sql);
			string text = "";
			string text2 = "";
			for (int i = 0; i < dataTable2.Rows.Count; i++)
			{
				DataRow dataRow = dataTable2.Rows[i];
				int num = 0;
				if (dataRow["ProductType"] != DBNull.Value)
				{
					num = dataRow["ProductType"].ToString().ToInt32(new int[0]);
				}
				if (num > 0)
				{
					int num2 = 0;
					try
					{
						if (dataTable2.Rows[i]["DeliverPayType"] != DBNull.Value)
						{
							if (dataTable2.Rows[i]["DeliverPayType"].ToString().Trim() == "1")
							{
								if (dataTable2.Rows[i]["DeliverType"] != DBNull.Value)
								{
									num2 = dataTable2.Rows[i]["DeliverType"].ToString().ToInt32(new int[0]);
								}
							}
							else
							{
								num2 = 0;
							}
						}
					}
					catch
					{
						num2 = 0;
					}
					object obj = text2;
					text2 = string.Concat(new object[]
					{
						obj,
						num,
						",",
						num2,
						"|"
					});
					text = text + num + "|";
				}
			}
			Hashtable hashtable = new Hashtable();
			if (!string.IsNullOrEmpty(text2))
			{
				text2 = text2.Substring(0, text2.Length - 1);
				text = text.Substring(0, text.Length - 1);
				ArrayList arrayList = new ArrayList();
				string[] array = text.Split(new char[]
				{
					'|'
				});
				for (int j = 0; j < array.Length; j++)
				{
					string text3 = array[j].ToString();
					if (!arrayList.Contains(text3))
					{
						arrayList.Add(text3);
					}
				}
				for (int k = 0; k < arrayList.Count; k++)
				{
					string text4 = arrayList[k].ToString();
					string key = text4;
					string text5 = "";
					string[] array2 = text2.Split(new char[]
					{
						'|'
					});
					for (int l = 0; l < array2.Length; l++)
					{
						string[] array3 = array2[l].Split(new char[]
						{
							','
						});
						if (array3.Length >= 2)
						{
							if (text4 == array3[0].Trim())
							{
								text5 = text5 + array3[1] + ",";
							}
						}
					}
					if (!string.IsNullOrEmpty(text5))
					{
						text5 = text5.Substring(0, text5.Length - 1);
						hashtable.Add(key, text5);
					}
				}
			}
			ArrayList arrayList2 = new ArrayList(hashtable.Keys);
			foreach (string text6 in arrayList2)
			{
				string[] array4 = hashtable[text6].ToString().Split(new char[]
				{
					','
				});
				if (array4.Length > 0)
				{
					int[] array5 = new int[array4.Length];
					for (int m = 0; m < array4.Length; m++)
					{
						array5[m] = array4[m].ToInt32(new int[0]);
					}
					ArrayList arrayList3 = new ArrayList();
					arrayList3.Add(array5[0]);
					for (int i = 1; i < array5.Length; i++)
					{
						bool flag = true;
						for (int n = 0; n < arrayList3.Count; n++)
						{
							if (array5[i] == int.Parse(arrayList3[n].ToString()))
							{
								flag = false;
							}
						}
						if (flag)
						{
							arrayList3.Add(array5[i]);
						}
					}
					DataView defaultView = dataTable2.DefaultView;
					defaultView.RowFilter = "ProductType=" + int.Parse(text6);
					string text7 = "";
					for (int i = 0; i < arrayList3.Count; i++)
					{
						text7 = "";
						int num3 = int.Parse(arrayList3[i].ToString());
						foreach (DataRowView dataRowView in defaultView)
						{
							if (int.Parse(dataRowView["deliverType"].ToString()) == num3)
							{
								text7 = text7 + dataRowView["productID"].ToString() + ",";
							}
						}
						if (!string.IsNullOrEmpty(text7))
						{
							text7 = text7.Substring(0, text7.Length - 1);
							DataRow dataRow2 = dataTable.NewRow();
							dataRow2["ProductID"] = text7;
							dataRow2["ProductType"] = text6;
							dataRow2["DeliverType"] = num3;
							dataTable.Rows.Add(dataRow2);
						}
					}
				}
			}
		}
		return dataTable;
	}
	public DataTable dtInfo(string productidStr)
	{
		DataTable dataTable = new DataTable();
		Member_test2.SetNewDataColumn(dataTable);
		this.GetProductTableByIds(dataTable, productidStr);
		return dataTable;
	}
	private void GetProductTableByIds(DataTable newTable, string newProductIds)
	{
		if (!string.IsNullOrEmpty(newProductIds))
		{
			string sql = "select * from HLShop_Product where ProductID in (" + newProductIds + ")";
			DataTable dataTable = this.conn.GetDataTable(sql);
			for (int i = 0; i < dataTable.Rows.Count; i++)
			{
				DataRow dataRow = dataTable.Rows[i];
				int num = 0;
				if (dataRow["ProductID"] != DBNull.Value)
				{
					num = Convert.ToInt32(dataRow["ProductID"].ToString());
				}
				int num2 = 0;
				if (dataRow["ProductType"] != DBNull.Value)
				{
					num2 = Convert.ToInt32(dataRow["ProductType"].ToString());
				}
				string value = "";
				if (dataRow["ProductName"] != DBNull.Value)
				{
					value = dataRow["ProductName"].ToString();
				}
				string value2 = "";
				if (dataRow["ProductSmallImageUrl"] != DBNull.Value)
				{
					value2 = dataRow["ProductSmallImageUrl"].ToString();
				}
				int num3 = 0;
				if (dataRow["Stocks"] != DBNull.Value)
				{
					num3 = Convert.ToInt32(dataRow["Stocks"].ToString());
				}
				decimal num4 = 0m;
				if (dataRow["StandPrice"] != DBNull.Value)
				{
					num4 = dataRow["StandPrice"].ToString().ToDecimal2();
				}
				string value3 = "";
				if (dataRow["PUnit"] != DBNull.Value)
				{
					value3 = dataRow["PUnit"].ToString();
				}
				int num5 = 0;
				if (dataRow["NeedInvoice"] != DBNull.Value)
				{
					string text = dataRow["NeedInvoice"].ToString().Trim();
					if (text == "1" || text.ToLower() == "true")
					{
						num5 = 1;
					}
					else
					{
						num5 = 0;
					}
				}
				decimal num6 = 0m;
				if (dataRow["TaxRate"] != DBNull.Value)
				{
					num6 = dataRow["TaxRate"].ToString().ToDecimal2();
				}
				int num7 = 0;
				if (dataRow["PresentExp"] != DBNull.Value)
				{
					num7 = Convert.ToInt32(dataRow["PresentExp"].ToString());
				}
				decimal num8 = 0m;
				if (dataRow["PresentMoney"] != DBNull.Value)
				{
					num8 = dataRow["PresentMoney"].ToString().ToDecimal2();
				}
				int num9 = 0;
				if (dataRow["PresentPoint"] != DBNull.Value)
				{
					num9 = Convert.ToInt32(dataRow["PresentPoint"].ToString());
				}
				int num10 = 0;
				if (dataRow["Cycle"] != DBNull.Value)
				{
					num10 = Convert.ToInt32(dataRow["Cycle"].ToString());
				}
				int num11 = 0;
				string text2 = dataRow["DeliverPayType"].ToString();
				if (text2 != "0")
				{
					num11 = Convert.ToInt32(dataRow["DeliverType"]);
				}
				string text3 = "";
				string text4 = "";
				if (text2 != "0")
				{
					Shop_DeliverType shop_DeliverType = new Shop_DeliverType(this.conn);
					DataTable tableType = shop_DeliverType.GetTableType(num11);
					foreach (DataRow dataRow2 in tableType.Rows)
					{
						string text5 = "";
						decimal defaultPrice = 0m;
						decimal deincrementPrice = 0m;
						string arriveArea = "";
						if (dataRow2["TypeName"] != DBNull.Value)
						{
							string text6 = dataRow2["TypeName"].ToString();
						}
						if (dataRow2["name"] != DBNull.Value)
						{
							text5 = dataRow2["name"].ToString();
						}
						if (dataRow2["default"] != DBNull.Value)
						{
							defaultPrice = dataRow2["default"].ToString().ToDecimal2();
						}
						if (dataRow2["defIncrement"] != DBNull.Value)
						{
							deincrementPrice = dataRow2["defIncrement"].ToString().ToDecimal2();
						}
						if (dataRow2["area"] != DBNull.Value)
						{
							arriveArea = dataRow2["area"].ToString();
						}
						text4 = text4 + text5 + "|";
						text3 = text3 + shop_DeliverType.SetDeliverChargeContentDetail(num11, text5, arriveArea, defaultPrice, deincrementPrice) + "|";
					}
					if (!string.IsNullOrEmpty(text3))
					{
						text4 = text4.Substring(0, text4.Length - 1);
						text3 = text3.Substring(0, text3.Length - 1);
					}
				}
				DataRow dataRow3 = newTable.NewRow();
				dataRow3["ProductID"] = num;
				dataRow3["ProductType"] = num2;
				dataRow3["ProductName"] = value;
				dataRow3["ProductSmallImageUrl"] = value2;
				dataRow3["Stocks"] = num3;
				dataRow3["StandPrice"] = num4;
				dataRow3["PUnit"] = value3;
				dataRow3["DeliverPayType"] = text2;
				dataRow3["DeliverType"] = num11;
				dataRow3["DeliveName"] = text4;
				dataRow3["deliverCharge"] = text3;
				dataRow3["NeedInvoice"] = num5;
				dataRow3["TaxRate"] = num6;
				dataRow3["PresentExp"] = num7;
				dataRow3["PresentMoney"] = num8;
				dataRow3["PresentPoint"] = num9;
				dataRow3["Cycle"] = num10;
				newTable.Rows.Add(dataRow3);
			}
		}
	}
	private static void SetNewDataColumn(DataTable newTable)
	{
		DataColumn column = new DataColumn("ProductID", typeof(int));
		newTable.Columns.Add(column);
		DataColumn column2 = new DataColumn("ProductType", typeof(int));
		newTable.Columns.Add(column2);
		DataColumn column3 = new DataColumn("ProductName", typeof(string));
		newTable.Columns.Add(column3);
		DataColumn column4 = new DataColumn("ProductSmallImageUrl", typeof(string));
		newTable.Columns.Add(column4);
		DataColumn column5 = new DataColumn("Stocks", typeof(int));
		newTable.Columns.Add(column5);
		DataColumn column6 = new DataColumn("StandPrice", typeof(decimal));
		newTable.Columns.Add(column6);
		DataColumn column7 = new DataColumn("PUnit", typeof(string));
		newTable.Columns.Add(column7);
		DataColumn column8 = new DataColumn("DeliverPayType", typeof(int));
		newTable.Columns.Add(column8);
		DataColumn column9 = new DataColumn("DeliverType", typeof(int));
		newTable.Columns.Add(column9);
		DataColumn column10 = new DataColumn("DeliveName", typeof(string));
		newTable.Columns.Add(column10);
		DataColumn column11 = new DataColumn("deliverCharge", typeof(string));
		newTable.Columns.Add(column11);
		DataColumn column12 = new DataColumn("NeedInvoice", typeof(int));
		newTable.Columns.Add(column12);
		DataColumn column13 = new DataColumn("TaxRate", typeof(decimal));
		newTable.Columns.Add(column13);
		DataColumn column14 = new DataColumn("PresentExp", typeof(int));
		newTable.Columns.Add(column14);
		DataColumn column15 = new DataColumn("PresentMoney", typeof(decimal));
		newTable.Columns.Add(column15);
		DataColumn column16 = new DataColumn("PresentPoint", typeof(int));
		newTable.Columns.Add(column16);
		DataColumn column17 = new DataColumn("Cycle", typeof(int));
		newTable.Columns.Add(column17);
	}
}
